import { defineStore } from 'pinia'
import { userSession } from '@/api/auth'
import type { IUser } from '@/api/auth'

export const useUserStore = defineStore('user', {
  state: () => ({
    user: {
      name: '管理员'
    } as IUser
  }),
  actions: {
    async bootstrap() {
      const user = await userSession()
      this.user = user
      return user
    }
  }
})
